<!-- $Id: goods_list.htm 17126 2010-04-23 10:30:26Z liuhui $ -->

{if $full_page}
{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,listtable.js"}

<!-- 商品搜索 -->
{include file="suppliers_goods_search.htm"}
<!-- 商品列表 -->
<form method="post" action="" name="listForm" onsubmit="return confirmSubmit(this)">
  <!-- start goods list -->
  <div class="list-div" id="listDiv">
{/if}
<table cellpadding="3" cellspacing="1">
  <tr>
    <th>
      <input onclick='listTable.selectAll(this, "checkboxes")' type="checkbox" />
      <a href="javascript:listTable.sort('goods_id'); ">{$lang.record_id}</a>{$sort_goods_id}
    </th>
    
    <th>商家</th>
    <th><a href="javascript:listTable.sort('goods_name'); ">{$lang.goods_name}</a>{$sort_goods_name}</th>
    <th><a href="javascript:listTable.sort('goods_sn'); ">{$lang.goods_sn}</a>{$sort_goods_sn}</th>
    <th><a href="javascript:listTable.sort('shop_price'); ">{$lang.shop_price}</a>{$sort_shop_price}</th>
    <th><a href="javascript:listTable.sort('team_num'); ">参团人数</a>{$sort_team_num}</th>
    <th><a href="javascript:listTable.sort('team_price'); ">团购价格</a>{$sort_team_price}</th>
    <th>团购销量</th>
    
        <th><a href="javascript:listTable.sort('is_best'); ">{$lang.is_best}</a>{$sort_is_best}</th>
    <th><a href="javascript:listTable.sort('is_new'); ">{$lang.is_new}</a>{$sort_is_new}</th>
    <th><a href="javascript:listTable.sort('is_hot'); ">{$lang.is_hot}</a>{$sort_is_hot}</th>

    
    <th><a href="javascript:listTable.sort('is_on_sale'); ">{$lang.is_on_sale}</a>{$sort_is_on_sale}</th>
    
    <th><a href="javascript:listTable.sort('is_tejia'); ">特价</a>{$sort_is_tejia}</th>
    <th><a href="javascript:listTable.sort('is_fresh'); ">新人专享</a>{$sort_is_fresh}</th>
    <th><a href="javascript:listTable.sort('is_zero'); ">零元购</a>{$sort_is_zero}</th>

    
    
    <th><a href="javascript:listTable.sort('is_check'); ">审核</a>{$sort_is_check}</th>

    <th><a href="javascript:listTable.sort('sort_order'); ">{$lang.sort_order}</a>{$sort_sort_order}</th>
    {if $use_storage}
    <th><a href="javascript:listTable.sort('goods_number'); ">{$lang.goods_number}</a>{$sort_goods_number}</th>
    {/if}
    <th>{$lang.handler}</th>
  <tr>
  {foreach from=$goods_list item=goods}
  <tr>
    <td align="center"><input type="checkbox" name="checkboxes[]" value="{$goods.goods_id}" />{$goods.goods_id}</td>
    
    <td align="center" class="first-cell" >{$goods.suppliers_name}</td>
    <td align="left" class="first-cell" style="{if $goods.is_miao}color:red;{/if}"><span onclick="listTable.edit(this, 'edit_goods_name', {$goods.goods_id})">{$goods.goods_name|escape:html}</span>{if $goods.limit_buy_one eq 1}<font style="color:#F00;">[限购]{/if}</font>{if $goods.is_zero eq 1}<font style="color:#F00;">[0元购]{/if}</font></td>
    <td align="center"><span onclick="listTable.edit(this, 'edit_goods_sn', {$goods.goods_id})">{$goods.goods_sn}</span></td>
    <td align="center"><span onclick="listTable.edit(this, 'edit_goods_price', {$goods.goods_id})">{$goods.shop_price}

    </span></td>
    <td align="center"><span onclick="listTable.edit(this, 'edit_team_num', {$goods.goods_id})">{$goods.team_num}

    </span></td>
    <td align="center"><span onclick="listTable.edit(this, 'edit_team_price', {$goods.goods_id})">{$goods.team_price}

    </span></td>
    <td align="center"><span onclick="listTable.edit(this, 'edit_sales_num', {$goods.goods_id})">{$goods.sales_num}

    </span></td>
    <td align="center"><img src="images/{if $goods.is_best}yes{else}no{/if}.gif" onclick="listTable.toggle(this, 'toggle_best', {$goods.goods_id})" /></td>

    
    <td align="center"><img src="images/{if $goods.is_new}yes{else}no{/if}.gif" onclick="listTable.toggle(this, 'toggle_new', {$goods.goods_id})" /></td>
    <td align="center"><img src="images/{if $goods.is_hot}yes{else}no{/if}.gif" onclick="listTable.toggle(this, 'toggle_hot', {$goods.goods_id})" /></td>
    <td align="center"><img src="images/{if $goods.is_on_sale}yes{else}no{/if}.gif" onclick="listTable.toggle(this, 'toggle_on_sale', {$goods.goods_id})" /></td>
    <td align="center"><img src="images/{if $goods.is_tejia}yes{else}no{/if}.gif" onclick="listTable.toggle(this, 'toggle_tejia', {$goods.goods_id})" /></td>
    
    <td align="center"><img src="images/{if $goods.is_fresh}yes{else}no{/if}.gif" onclick="listTable.toggle(this, 'toggle_fresh', {$goods.goods_id})" /></td>

    <td align="center"><img src="images/{if $goods.is_zero}yes{else}no{/if}.gif"/></td>

   <td align="center">
        {if $goods.is_check eq 1}已审核&nbsp;&nbsp;<a href="suppliers_goods.php?act=check&id={$goods.goods_id}&is_check=1&page={$filter.page}">取消审核</a>{/if}
    {if $goods.is_check eq 0}审核中&nbsp;&nbsp;<a href="suppliers_goods.php?act=check&id={$goods.goods_id}&is_check=0&page={$filter.page}">立即审核</a>{/if}
    {if $goods.is_check eq 2}<span style="color:#F00;">未通过</span>&nbsp;&nbsp;<a href="suppliers_goods.php?act=check&id={$goods.goods_id}&is_check=2&page={$filter.page}">继续审核</a>{/if}
    </td>
   
    <td align="center"><span onclick="listTable.edit(this, 'edit_sort_order', {$goods.goods_id})">{$goods.sort_order}</span></td>
    {if $use_storage}
    <td align="center"><span onclick="listTable.edit(this, 'edit_goods_number', {$goods.goods_id})">{$goods.goods_number}</span></td>
    {/if}
    <td width="200" class="bnt_a">

      <a href="suppliers_goods.php?act=edit&goods_id={$goods.goods_id}{if $code neq 'real_goods'}&extension_code={$code}{/if}&page={$filter.page}" title="{$lang.edit}">{$lang.edit}</a>
      <a href="suppliers_goods.php?act=copy&goods_id={$goods.goods_id}{if $code neq 'real_goods'}&extension_code={$code}{/if}" title="{$lang.copy}">{$lang.copy}</a>
      <a href="javascript:;" onclick="listTable.remove({$goods.goods_id}, '{$lang.trash_goods_confirm}')" title="{$lang.trash}">{$lang.trash}</a>
      {if $specifications[$goods.goods_type] neq ''}<a href="suppliers_goods.php?act=product_list&goods_id={$goods.goods_id}" title="{$lang.item_list}">{$lang.item_list}</a>{/if}
      {if $add_handler}
        {foreach from=$add_handler item=handler}
        <a href="{$handler.url}&goods_id={$goods.goods_id}" title="{$handler.title}">{$handler.title}</a>
        {/foreach}
      {/if}
    </td>
  </tr>
  {foreachelse}
  <tr><td class="no-records" colspan="11">{$lang.no_records}</td></tr>
  {/foreach}
</table>
<!-- end goods list -->

<!-- 分页 -->
<table id="page-table" cellspacing="0">
  <tr>
    <td align="right" nowrap="true">
    {include file="page.htm"}
    </td>
  </tr>
</table>

{if $full_page}
</div>

<div>
  <input type="hidden" name="act" value="batch" />
  <select name="type" id="selAction" onchange="changeAction()">
    <option value="">{$lang.select_please}</option>
    <option value="trash">{$lang.trash}</option>
    <option value="on_sale">{$lang.on_sale}</option>
    <option value="not_on_sale">{$lang.not_on_sale}</option>
    <!--<option value="best">{$lang.best}</option>
    <option value="not_best">{$lang.not_best}</option>
    <option value="new">{$lang.new}</option>
    <option value="not_new">{$lang.not_new}</option>
    <option value="hot">{$lang.hot}</option>
    <option value="not_hot">{$lang.not_hot}</option>-->
    <option value="move_to">{$lang.move_to}</option>
	
  </select>
  <select name="target_cat" style="display:none">
    <option value="0">{$lang.select_please}</option>{$cat_list}
  </select>
	{if $suppliers_list > 0}
  <!--二级主菜单：转移供货商-->
  <select name="suppliers_id" style="display:none">
    <option value="-1">{$lang.select_please}</option>
    <option value="0">{$lang.lab_to_shopex}</option>
    {foreach name=sln from=$suppliers_list item=sl}
      <option value="{$sl.suppliers_id}">{$sl.suppliers_name}</option>
    {/foreach}
  </select>
  <!--end!-->
	{/if}  
  {if $code neq 'real_goods'}
  <input type="hidden" name="extension_code" value="{$code}" />
  {/if}
  <input type="submit" value="{$lang.button_submit}" id="btnSubmit" name="btnSubmit" class="button" disabled="true" />
</div>
</form>

<script type="text/javascript">
  listTable.recordCount = {$record_count};
  listTable.pageCount = {$page_count};

  {foreach from=$filter item=item key=key}
  listTable.filter.{$key} = '{$item}';
  {/foreach}

  {literal}
  onload = function()
  {
    startCheckOrder(); // 开始检查订单
    document.forms['listForm'].reset();
  }

  /**
   * @param: bool ext 其他条件：用于转移分类
   */
  function confirmSubmit(frm, ext)
  {
      if (frm.elements['type'].value == 'trash')
      {
          return confirm(batch_trash_confirm);
      }
      else if (frm.elements['type'].value == 'not_on_sale')
      {
          return confirm(batch_no_on_sale);
      }
      else if (frm.elements['type'].value == 'move_to')
      {
          ext = (ext == undefined) ? true : ext;
          return ext && frm.elements['target_cat'].value != 0;
      }
      else if (frm.elements['type'].value == '')
      {
          return false;
      }
      else
      {
          return true;
      }
  }

  function changeAction()
  {
      var frm = document.forms['listForm'];

      // 切换分类列表的显示
      frm.elements['target_cat'].style.display = frm.elements['type'].value == 'move_to' ? '' : 'none';
			
			{if $suppliers_list > 0}
      frm.elements['suppliers_id'].style.display = frm.elements['type'].value == 'suppliers_move_to' ? '' : 'none';
			{/if}

      if (!document.getElementById('btnSubmit').disabled &&
          confirmSubmit(frm, false))
      {
          frm.submit();
      }
  }
{/literal}
</script>
{include file="pagefooter.htm"}
{/if}